How can I store a Password using dxl?

Hello

Actually I'm writing an connection do a different tool. There I have a Logon-Dialog to insert a username and a password and I have a small dxl script whicht itself aks the user for those data.

So I get the data from the user and use the for the Logon of the tool.

The dxl-Dialig shall support a checkbox "Store the passord and use it for other tool sessisons too". The consequences of this is to store the password anywhere. So my question is:

Where is a good place to store a user password?
Is there any encryption method which can be used by a dxl-script?

Thanks for any help
Best regards
Wolfgang
SystemAdmin - Thu Jan 24 03:15:59 EST 2013

Re: How can I store a Password using dxl?
Mathias Mamsch - Thu Jan 24 06:00:47 EST 2013

Well I guess a reasonable place for storing the password is the user profile directory, since that usually is something where only the user should have access. So you could
 

string dir = getenv "USERPROFILE"
// ... make sub directory, store to file ...

and make a subdirectory for your application. Another place to store it would be the user config area of the DOORS database but I would not recommend that, since DOORS data is inherently insecure.


Regarding encryption, in the end you will need the clear text password again, so you cannot apply a hash to the password. Therefore you could apply a simple encryption scheme, e.g. using the build-in DOORS perms, but I doubt this will really be worth the effort or add relevant security. However you can experiment with it.

 

Buffer decryptBuffer__ (Buffer src, Buffer dest)
Buffer encryptBuffer__ (Buffer src, Buffer dest)


As far as I remember the perms return 'dest'. Hope this helps, regards, Mathias

 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: How can I store a Password using dxl?
SystemAdmin - Thu Jan 24 07:33:48 EST 2013

Mathias Mamsch - Thu Jan 24 06:00:47 EST 2013

Well I guess a reasonable place for storing the password is the user profile directory, since that usually is something where only the user should have access. So you could
 

string dir = getenv "USERPROFILE"
// ... make sub directory, store to file ...

and make a subdirectory for your application. Another place to store it would be the user config area of the DOORS database but I would not recommend that, since DOORS data is inherently insecure.


Regarding encryption, in the end you will need the clear text password again, so you cannot apply a hash to the password. Therefore you could apply a simple encryption scheme, e.g. using the build-in DOORS perms, but I doubt this will really be worth the effort or add relevant security. However you can experiment with it.

 

Buffer decryptBuffer__ (Buffer src, Buffer dest)
Buffer encryptBuffer__ (Buffer src, Buffer dest)


As far as I remember the perms return 'dest'. Hope this helps, regards, Mathias

 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Hello Mathias

Thank you that was a very good idea. But I'll store the data not only on the pc but in a region, which only can be read by the user.

Your small encryption routines are very interesting. They really work in this small script snippet.
 

string Encrypt(string sToEncrypt) {
    Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToEncrypt;
 
        encryptBuffer__ (bufInput, bufOutput);
        
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        return (sOut);
}
 
string Decrypt(string sToDecrypt) {
        Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToDecrypt;
 
        decryptBuffer__ (bufInput, bufOutput);
 
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        return (sOut);
}
 
// PasswordModuleInit();
string sH = Encrypt("UserName:Ich;Password:Du");
print ":" sH ":\n";
sH = Decrypt("150191176220182162185176164177164212166186162180182183202173148115124182");
print ":" sH ":\n";

If have made some experiments using the third buffer

 

Buffer bufHelp = decryptBuffer__ (bufInput, bufOutput);


but this seems to be a duplicate of "bufOutput". It is not a copy, because if I use an extended script, doors will crash in less than 10 evaluations.

 

 

string Encrypt(string sToEncrypt) {
    Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToEncrypt;
 
        Buffer bufHelp = decryptBuffer__ (bufInput, bufOutput);
        
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        delete(bufHelp);
        return (sOut);
}


So I recommend to use the function as outlined in the first code snippet. Any you are right, that is not a real security. It is a small padlock, nothing more.

Best regards
Wolfgang

 

 

Re: How can I store a Password using dxl?
SystemAdmin - Thu Jan 24 09:24:51 EST 2013

SystemAdmin - Thu Jan 24 07:33:48 EST 2013

Hello Mathias

Thank you that was a very good idea. But I'll store the data not only on the pc but in a region, which only can be read by the user.

Your small encryption routines are very interesting. They really work in this small script snippet.
 

string Encrypt(string sToEncrypt) {
    Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToEncrypt;
 
        encryptBuffer__ (bufInput, bufOutput);
        
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        return (sOut);
}
 
string Decrypt(string sToDecrypt) {
        Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToDecrypt;
 
        decryptBuffer__ (bufInput, bufOutput);
 
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        return (sOut);
}
 
// PasswordModuleInit();
string sH = Encrypt("UserName:Ich;Password:Du");
print ":" sH ":\n";
sH = Decrypt("150191176220182162185176164177164212166186162180182183202173148115124182");
print ":" sH ":\n";

If have made some experiments using the third buffer

 

Buffer bufHelp = decryptBuffer__ (bufInput, bufOutput);


but this seems to be a duplicate of "bufOutput". It is not a copy, because if I use an extended script, doors will crash in less than 10 evaluations.

 

 

string Encrypt(string sToEncrypt) {
    Buffer bufInput = create();
        Buffer bufOutput = create();
        bufInput = sToEncrypt;
 
        Buffer bufHelp = decryptBuffer__ (bufInput, bufOutput);
        
        string sOut = stringOf(bufOutput);
        delete(bufInput);
        delete(bufOutput);
        delete(bufHelp);
        return (sOut);
}


So I recommend to use the function as outlined in the first code snippet. Any you are right, that is not a real security. It is a small padlock, nothing more.

Best regards
Wolfgang

 

 

It is a very hard task not to guess the decryption text by reading the encryption code. I think it is better not to use it.